<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>电池异常量</title>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1"
    />
    <link
      rel="stylesheet"
      href="../../lib/layui-v2.5.5/css/layui.css"
      media="all"
    />
    <link rel="stylesheet" href="../../css/public.css" media="all" />
  </head>
  <style>
    .layui-table-grid-down {
      display: none;
    }
  </style>
  <body>
    <div class="layuimini-container">
      <div class="layuimini-main">
        <div id="Myloading">
          <img
            src="../../lib/layui-v2.5.5/css/modules/layer/default/loading-01.gif"
            alt=""
          />
        </div>
        <script type="text/html" id="toolbarDemo">
          <div style="color:#666">当前站点列表</div>
          <div class="layui-btn-container">
            <!-- <button class="layui-btn layui-btn-sm data-add-btn"  layuimini-content-href="./page/test.html"> 当前站点列表 </button> -->
            <!-- <button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除设备 </button> -->
          </div>
        </script>

        <table
          class="layui-hide"
          id="HcurrentTableId"
          lay-filter="currentTableFilter"
        ></table>

        <script type="text/html" id="currentTableBar">
          <a
            class="layui-btn layui-btn-xs data-count-edit"
            data-title="设备列表"
            lay-event="edit"
            >查看设备</a
          >
          <a
            class="layui-btn layui-btn-xs data-count-edit layui-btn-danger"
            data-title="报警事项"
            layuimini-content-href="page/table/HalarmList.html"
            lay-event="delete"
            >报警</a
          >
        </script>
      </div>
    </div>
    <script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script src="../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
    <script
      src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js"
      charset="utf-8"
    ></script>
    <script>
      layui.use(["form", "table", "miniTab"], function () {
        // 2020-03-25 HF 保存token
        var token = sessionStorage.getItem("newtoken");
        var $ = layui.jquery,
          form = layui.form,
          miniTab = layui.miniTab,
          table = layui.table;
        miniTab.listen();

        table.render({
          elem: "#HcurrentTableId",
          url: "/oms-web/statistics/abnormalBattery?token=" + token,
          // url:'../api/ceshi.json',
          toolbar: "#toolbarDemo",
          parseData: function (res) {
            //res 即为原始返回的数据
            return {
              code: res.code, //解析接口状态
              msg: res.msg, //解析提示文本
              count: res.data.total, //解析数据长度
              data: res.data.list, //解析数据列表
            };
          },
          defaultToolbar: [
            "filter",
            "exports",
            "print",
            {
              title: "提示",
              layEvent: "LAYTABLE_TIPS",
              icon: "layui-icon-tips",
            },
          ],

          cols: [
            [
              //复选框 {type: "checkbox", width: 50, fixed: "left"},
              { type: "numbers", width: 120, title: "序号", align: "center" },
              {
                field: "stationText",
                minWidth: 110,
                title: "站点名称",
                align: "center",
              },
              {
                field: "deviceText",
                minWidth: 110,
                title: "设备名称",
                align: "center",
              },
              {
                field: "terminalText",
                minWidth: 110,
                title: "终端名称",
                align: "center",
              },
              {
                field: "wangguan",
                minWidth: 110,
                title: "网关编号",
                align: "center",
              },
              {
                field: "terminalCode",
                minWidth: 110,
                title: "终端编号",
                align: "center",
              },
              {
                field: "value",
                minWidth: 110,
                title: "电量值",
                align: "center",
              },
              // {field: 'sign', title: '签名', minWidth: 120, align: "center"},
              // {title: '操作', width: 150, templet: '#currentTableBar', fixed: "right", align: "center"}
            ],
          ],
          limits: [10, 15, 20, 25, 50, 100],
          limit: 15,
          page: true,
          done: function (res) {
            if (res.code == -1) {
              window.location = "../login-1.html";
            }
            // 表格渲染完成回调
            $("#Myloading").remove();
          },
        });
      });
    </script>
  </body>
</html>
